﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AppleEvent
{
    class Apple
    {
        public event EventHandler<MyEventArgs> dePrice;
        private int _price;
        private int oldprice;
        public int price
        {
            get { return _price; }
            set
            {
                if (value == _price)
                {
                    return;
                }
                oldprice = _price;
                _price = value;
                if (price < oldprice)
                {
                    OndePrice(new MyEventArgs(oldprice, price));
                }

            }
        }

        private void OndePrice(MyEventArgs e)
        {
            if (dePrice != null)
            {
                dePrice(this, e);
            }

        }
    }
}
